package com.droowa.model.dao;

import java.sql.SQLException;
import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.droowa.domain.PaymentManagement;

@Repository
public class PaymentManagementDAOMybatisImpl implements PaymentManagementDAO{
	
	@Autowired
	private SqlSessionTemplate session;

	@Override
	public int insertPaymentManagement(PaymentManagement paymentManagement)
			throws SQLException {
		return session.insert(makeSqlId("insertPaymentManagement"), paymentManagement);
	}

	@Override
	public int deletePaymentManagement() throws SQLException {
		return session.delete(makeSqlId("deletePaymentManagement"));
	}

	@Override
	public int updatePaymentManagement(PaymentManagement paymentManagement)
			throws SQLException {
		return session.update(makeSqlId("updatePaymentManagement"), paymentManagement);
	}

	@Override
	public PaymentManagement selectPaymentManagement() throws SQLException {
		return session.selectOne(makeSqlId("selectPaymentManagement"));
	}

	private String makeSqlId(String id){
		return "droowa.paymentManagement."+id;
	}
	
}
